﻿/**
 * @brief 区分并读取".vtk"格式的数据
 * 目前可区分读取 vtkPolyData/vtkUnstructedGrid/vtkStructuredGrid类型
 */
#ifndef PST_MUTIVTKFILESREADER_H
#define PST_MUTIVTKFILESREADER_H
#include <QString>
#include <QList>
#include <vtkSmartPointer.h>
// #include <vtkObject.h>

class vtkPolyDataReader;
class vtkPointSet;
class vtkUnstructuredGridReader;
class vtkStructuredGridReader;
class vtkGenericDataObjectReader;

namespace pst
{
    class MutiVTKFilesReader //: public  vtkObject
    {
        enum DataType
        {
            POLYDATA,
            UNSTRUCTEDGRID,
            STRUCTEDGRID,
            UNKNOWN // 包括 文件不存在 和 不支持的.vtk格式 两种类型
        };

    public:
        MutiVTKFilesReader();
        ~MutiVTKFilesReader();

    public:
        void SetFileName(const QString& fileName);
        QString GetFileName() const;

        bool Update(QString& errorMess);
        vtkPointSet* GetOutput();
        // 获取文件的内部类型，如vtkPolyData、vtkUnstructedGrid
        QString GetFileInnerTypeAsStrng();

        void SetOtherList(const QList<MutiVTKFilesReader*>& otherList)
        {
            m_otherList = otherList;
        }

        QList<MutiVTKFilesReader*> GetOtherList() const
        {
            return m_otherList;
        }

        void SetGeometryFileName(const QStringList& geometryFileName)
        {
            m_geometryFileName = geometryFileName;
        }

        QStringList GetGeometryFileName() const
        {
            return m_geometryFileName;
        }

    private:
        DataType CheckDataInnerType();

    private:
        QString m_fileName;
        // vtkPolyDataReader* m_polyDataReader;
        // vtkUnstructuredGridReader* m_unstructuredGridReader;
        // vtkStructuredGridReader* m_structuredGridReader;
        QString m_fileType;
        vtkPointSet* m_outputData;
        QList<MutiVTKFilesReader*> m_otherList;
        vtkSmartPointer<vtkGenericDataObjectReader> m_generalReader;
        QStringList m_geometryFileName;
    };

} // namespace pst
#endif // PST_MUTIVTKFILESREADER_H
